<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!-- public quote -->
<%@include file="/jsp/comm_css_include.jsp"%>
<!-- zTreeStyle.css -->
<link rel="stylesheet" type="text/css"
	href="${basePath}/css/zTreeStyle/demo.css">
<link rel="stylesheet" type="text/css"
	href="${basePath}/css/zTreeStyle/zTreeStyle/zTreeStyle.css">
<!-- jqgrid-->
<link
	href="${basePath}/css/plugins/jqgriddemo/css/ui.jqgrid-bootstrap.min.css"
	rel="stylesheet" />
<!doctype html>
<html>
<head>
</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight creditbody">
		<div class="iboxtitle">
			<span><i class="glyphicon glyphicon-map-marker"></i>&nbsp;系统管理&gt;预警配置</span>
			<a href="javascript:void(0)"></a>
		</div>
		<div class="ibox-content">
			<div class="jqGrid_wrapper">
				<table id="table_list_1"></table>
				<div id="pager_list_1"></div>
			</div>
		</div>
	</div>


	<!-- public quote -->
	<%@include file="/jsp/comm_js_include.jsp"%>

	<!-- jqGrid -->
	<script type="text/javascript" charset="utf-8"
		src="${basePath}/js/plugins/jqgriddemo/js/jquery.jqGrid.min.js"></script>
	<script type="text/javascript" charset="utf-8"
		src="${basePath}/js/plugins/jqgriddemo/js/grid.locale-cn.min.js"></script>

	<!--zTreeStyle.js-->
	<script type="text/javascript"
		src="${basePath}/js/zTreeStyle/jquery.ztree.core.js" charset="utf-8"></script>
	<script type="text/javascript"
		src="${basePath}/js/zTreeStyle/jquery.ztree.excheck.js"
		charset="utf-8"></script>

	<!--
    	作者：zhangpp
    	时间：2017-04-06
    	描述：js
    -->
	<script type="text/javascript">
	    jQuery(function($) {  
	    	getData();
	    });
	    var updateLayer;
	    var getData = function()
	    {
   	   	   winWidth = $(window).width();
   	   	   var winHeight = document.body.offsetHeight - 300;
  		   var win = winWidth / 7 - 20;
  		
  	 	   $.jgrid.defaults.styleUI = 'Bootstrap';
  	 	   
		  jQuery("#table_list_1").jqGrid
		  ({
			url:'${basePath}/OtherWantWarningController/list',
	        datatype : "json",
	        colNames : ['replaceId', 'busi_id', '消息类型', '消息事件类型','消息内容','待预警时间','消息状态'],
	        colModel : [  
						 {name: 'replaceId', index: '', hidden:true},
	                     {name: 'busiId',index: '',width: 100,hidden:true},
	                  	 {name: 'typeMsg',index: '',width: 80,align: "center"},
	               		 {name: 'typeMsgEvent',index: '',width: 80,align: "center"},
	               		 {name: 'content',index: '',width: 80,align: "center"},
	            		 {name: 'timeWarning',index: '',width: 100,align: "center"},
	            		 {name: 'statusMsg',index: '',width: 100,align: "center"}
	                   ],
              mtype : "post",
              height: winHeight,
              width:winWidth,  
              autowidth: true,
              shrinkToFit: true,
              rowNum: 15,
              rowList: [15, 30, 45],
              viewrecords: true,
              pager: "#pager_list_1",
              hidegrid: false,
              sortorder : "desc",
              sortname : 'created',
              multiselect : true,
              altRows:true,
              altclass:'someClass',
              ondblClickRow:function(rowId)
              {
            	  var row = $("#table_list_1").jqGrid("getRowData", rowId);
            	  //页面层
            	  layer.open({
            	    type: 1,
            	    area: ['50%', '40%'], //宽高
            	    content: '<div class="business-padding">'+row.content+'</div>'
            	  });
              },
              jsonReader : {
            	  root:"result.rows",
            	  page: "result.page",
            	  total: "result.total",
            	  records: "result.records",
            	  repeatitems: false,
            	  id: "replaceId" 
              },
              loadComplete:function(datas){
            	  if (datas.flag == "100100") {
                      layer.msg("查询成功!", {icon: 6, time: 1000});
                      return;
                  }
            	  if(datas.flag == '100802') {
    				  top.location.href = thisLoginUrl;
    				  return;
    			  }

            	  layer.msg(datas.message, {icon: 2});
              }
	      });
	    }	    
	    
	    window.onresize = function()
	    {
	    	$("#table_list_1").setGridWidth($(window).width()-80);
	    }
	    
	    var query = function()
	    {
	    	var postData = $("#table_list_1").jqGrid("getGridParam", "postData");
	    	var loginName = document.getElementById('loginName').value || '';
	    	$.extend(postData, { loginName : loginName.trim() });
	    	refresh();
	    }
	    
	    var refresh = function()
	    {
	    	$("#table_list_1").jqGrid("setGridParam", { search: true }).trigger("reloadGrid", [{ page: 1}]);
	    }
	   
	    
    </script>
</body>
</html>
